﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KeMei.Common;

public partial class DataDownload_DataDownloadList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ProductDataBind();
        }
    }

    /// <summary>
    /// 取得资料地址
    /// </summary>
    /// <param name="source"></param>
    /// <returns></returns>
    protected string GetFileUrl(string source)
    {
        return ConfigHelper.SystemUrl + source;
    }

    public DataTable GetDataTable
    {
        get
        {
            return ViewState["Table"] == null ? null : ViewState["Table"] as DataTable;
        }
        set
        {
            ViewState["Table"] = value;
        }
    }

    /// <summary>
    /// 绑定资料
    /// yd 2012-05-19
    /// </summary>
    private void ProductDataBind()
    {
        KeMei.BLL.Download bll = new KeMei.BLL.Download();
        DataSet ds = bll.GetList("1=1 order by Recorddate desc");
        DataTable dt = ds.Tables[0];
        //总数
        AspNetPager.RecordCount = dt.Rows.Count;

        GetDataTable = DataTableHelper.GetPagedTable(dt, AspNetPager.CurrentPageIndex, AspNetPager.PageSize);
        if (GetDataTable.Rows.Count > 0)
        {
            repDownload.DataSource = GetDataTable;
            repDownload.DataBind();
        }

    }

    protected void AspNetPager_PageChanged(object src, EventArgs e)
    {
        ProductDataBind();
    }
}